package deletedelete;

public class reverse {
    public static void main(String[] args) {

           String str="abcdefg";
           int startIndex=2;  int endIndex=5;
        char[] chars = str.toCharArray();
        System.out.println("反转前的顺序是:"+str);
           if (chars!=null){
                for (int a=startIndex, b=endIndex;  a<b; a++,b--){
                      char c=chars[a];
                      chars[a]=chars[b];
                      chars[b]= c;
                }
           }
        System.out.println(new String(chars));
    }
}
